<template>
	<view>
		<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
			<swiper-item v-for="(item,index) in 4" :key="index">
				<view class="swiper-item">
					<image src="../../static/imgs/home2.png" mode="aspectFill"></image>
				</view>
			</swiper-item>
		</swiper>
		<view>
			<input type="text" value="dsjkafskjsafsdf" >
		</view>
		<view class="flex justify-between flex-wrap padding-sm bg-white" >
			<view 
				v-for="item,index in 8" 
				:key='index' 
				class="flex flex-direction align-center padding"
			>
				<image class="imageWidth" src="../../static/imgs/mine2.png" mode=""></image>
				<view class="margin-top-sm">商铺转让</view>
			</view>
		</view>
		<view>
			<view class="u-demo-block padding" >
				<text class="u-demo-block__title">联系我们</text>
				<u-swiper
						:list="list3"
						previousMargin="0"
						nextMargin="170"
						circular
						:autoplay="false"
						radius="5"
						bgColor="#ffffff"
				>
				</u-swiper>
			</view>
		</view>
		<view class="bg-white findpub flex justify-between padding u-border-bottom">
			<img  src="../../static/imgs/mine2.png" alt="">
			<img src="../../static/imgs/mine2.png" alt="">
		</view>
		<view class="flex justify-between flex-wrap padding-sm bg-white" >
			<view 
				v-for="item,index in tradeList" 
				:key='item.objectId' 
				class="flex flex-direction align-center padding-10"
				:style="{order:item.tradename == '其他分类' ? 1 : item.tradename == '酒楼餐饮' ? -1 : 0,}"
			>
				<image class="tradeimg" :src="item.imageUrl" mode=""></image>
				<view class="margin-top-sm">{{item.tradename}}</view>
			</view>
		</view>
		<view class="cu-form-group margin-top">
			<view class="title">选择行业</view>
			<picker @change="PickerChange" :value="index" :range="tradenames">
				<view class="picker">
					{{index>-1?tradenames[index]:'不限'}}
				</view>
			</picker>
		</view>
		<view class="">
			<goods-list v-for="item,index in shopList" :shop-data="item" :key="item.objectId"/>
		</view>
	</view>
</template>

<script>
	import {tradeGet,shopsGet} from '../../api/uviewreq.js'
	export default {
		data() {
			return {
				index:-1,
				tradeList:[],
				tradenames:[],
				shopList:[],
				list3: [
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
				],
			}
		},
		methods: {
			PickerChange(e) {
				console.log(e)
				this.index = e.detail.value
			},
		},
		onLoad() {
			tradeGet().then(res=>{
				console.log(res);
				this.tradeList =  res.results;
				this.tradeList.forEach(item=>{
					this.tradenames.push(item.tradename)
				})
			})
			shopsGet().then(res=>{
				console.log(res)
				this.shopList = res.results;
			})
			// this.$request.get('/1.1/classes/trade').then(res=>{
			// 	this.tradeList =  res.data.results;
			// })
		}
	}
</script>

<style lang="scss">
	.imageWidth{
		width:40upx;
		height:50upx;
	}
	.findpub{
		img{
			width:320upx
		}		
	}
	.tradeimg{
		width:66upx;
		height:66upx;
	}
</style>
